"use strict";

exports.__esModule = true;
exports.columnHeaderScrollStrategy = columnHeaderScrollStrategy;
var _utils = require("../utils");
/**
 * Scroll strategy for column header selection.
 *
 * @param {Core} hot Handsontable instance.
 * @returns {function(): function(CellCoords): void}
 */
function columnHeaderScrollStrategy(hot) {
  return cellCoords => {
    const scrollColumnTarget = (0, _utils.createScrollTargetCalculator)(hot).getComputedColumnTarget(cellCoords);
    hot.scrollViewportTo({
      col: scrollColumnTarget
    }, () => {
      const hasColumnHeaders = !!hot.getSettings().colHeaders;
      (0, _utils.scrollWindowToCell)(hot.getCell(hasColumnHeaders ? -1 : 0, scrollColumnTarget, true));
    });
  };
}